package cc.lj.internal.payment.interfaces.facade;

import cc.lj.internal.api.payment.command.TicketSettlementApiCommand;
import cc.lj.internal.core.exception.SysExceptionEnum;
import cc.lj.internal.core.http.HttpResult;
import cc.lj.internal.payment.application.settlement.service.TicketSettlementAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 收款成功后电子券结算操作controller
 * @author liangxifeng
 * @date 2022-01-13
 */
@RestController
@Slf4j
@Validated
@RequestMapping("/ticket")
@Api(tags = "收款成功后电子券结算操作")
public class TicketSettlementController {
    @Resource(name = "ticketSettlementAppService")
    private TicketSettlementAppService ticketSettlementAppService;

    @ApiOperation(value = "收款成功后电子券结算操作",notes = "错误码：")
    @PostMapping("/settlement")
    public HttpResult<Object> settlemet(@Valid @RequestBody TicketSettlementApiCommand ticketSettlementApiCommand)
    {
        log.info("电子券补贴结算入参: {}",ticketSettlementApiCommand);
        Object res = ticketSettlementAppService.doMain(ticketSettlementApiCommand);
        return HttpResult.success(SysExceptionEnum.SUCCESS.getCode(),SysExceptionEnum.SUCCESS.getMessage(),res);
    }
}
